package com.china08.yxyapi.api.manage.sch.platform.website.template;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.china08.yxyapi.api.YxyApiBaseController;
import com.china08.yxyapi.entity.db.sws.SwsTempletModule;
import com.china08.yxyapi.repository.db.SwsTempletModuleRepository;

@CrossOrigin
@RestController
public class SwsModuleCrtController extends YxyApiBaseController {

    @Autowired
    SwsTempletModuleRepository swsTempletModuleRepository;

    @RequestMapping(value = "/api_yw/manage/sch/platform/website/module/crt", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Object precess(HttpServletRequest request, HttpServletResponse response) {

        List<String> list = new ArrayList<String>();
        // list.add("module_comm_logo");// 网站logo
        // list.add("module_comm_navbar_top");// 导航
        list.add("module_index_slider");// 焦点图
        list.add("module_index_article_01");// 推荐资讯
        list.add("module_index_album");// 学校相册
        list.add("module_index_overview");// 网站统计
        list.add("module_comm_about");// 关于我们
        list.add("module_comm_privacy");// 隐私保护
        for (String string : list) {
            Integer orderNum = list.indexOf(string) + 1;
            SwsTempletModule swsTempletModule = new SwsTempletModule();
            swsTempletModule.setTemplateId("templ003");
            swsTempletModule.setModuleId(string);
            swsTempletModule.setOrderNum(orderNum);
            swsTempletModuleRepository.save(swsTempletModule);
        }

        return null;

    }
}
